package com.example.controller;

import com.example.service.ReentrantLockExampleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/reentrant/lock/example")
public class ReentrantLockExampleController {

    @Autowired
    private ReentrantLockExampleService reentrantLockExampleService;

    @GetMapping("/lock-task")
    public String lockTask() {
        reentrantLockExampleService.executeCriticalTask();
        return "任务完成";
    }
}
